import java.io.File;
import java.util.List;

public class Txt2020 {
    public static void main(String[] args) {
        String folder_name = "622_经济经纬";
        File file = new File("D:\\测试临时文件\\黑马TXT\\"+folder_name);
        File[] files = file.listFiles();
        int count = 0;
        for (File file1 : files) {
            String coding = GetFileEncodingByPath.getEncodingByPath(file1.getPath());
            List<String> data = FileUtil.readFileData(file1.getPath(), coding);
//            int yushu = count %10;
//            System.out.println(count++);
//            System.out.println(yushu);
            File f=new File("D:\\测试临时文件\\黑马TXT\\GBK_TXT\\"+folder_name);
            if(!f.exists()){//如果文件夹不存在
                f.mkdir();//创建文件夹
                System.out.println(f.getName());
            }
            FileUtil.writerFile("D:\\测试临时文件\\黑马TXT\\GBK_TXT\\"+folder_name+"\\"+file1.getName(), data, "GBK");
            System.out.println(file1.getName()+"转换完成");
        }
    }
}
